package edu.zqu.collegeField.common.enums;

import java.util.HashMap;
import java.util.Map;
/**
 * @author 廖森
 * @Date 2020/7/4/004
 */
public enum FieldStatusEnum {
    上课(1, "class"),

    开会(2, "meeting"),

    外借(3, "lend");


    private static Map<Integer, FieldStatusEnum> valueMap = new HashMap<>();

    static {
        for (FieldStatusEnum e : FieldStatusEnum.values()) {
            valueMap.put(e.code, e);
        }
    }

    private Integer code;
    private String name;

    private FieldStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return this.code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static FieldStatusEnum valueOfCode(String code) {
        FieldStatusEnum result = valueMap.get(code);
        if (result == null) {
            throw new IllegalArgumentException("未知的枚举类型：" + code + ",请核对枚举 DoorEnum");
        }
        return result;
    }

    public Integer value() {
        return this.code;
    }
}
